<?php


class Test_getobjects extends CI_Controller {

	public function __construct() {
		parent::__construct(); 
                // the tutorial shows this as 
                // parent::Controller();
                
                
	}

	public function index() {
            global $em;

            //$user = $this->doctrine->em->find('ORM\Dynasties2\Users', 1);
            //$user = $this->doctrine->em->getRepository('ORM\Dynasties2\Users')->findOneBy(array('email' => 'xjermx@gmail.com'));
            
            $user = $this->doctrine->em->getRepository('ORM\Dynasties2\Users')->findOneBy(array('email' => 'xjermx@gmail.com', 'firstName' => 'xJeremy'));

            if(is_null($user))
                        {
                            // the "find" call returns NULL!
                            echo 'Returned NULL<br />';
                        } else {
            echo $user->getFirstName();
                        }
            
        }
}